package lc.二分;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/16
 */
public class 剑指Offer11_旋转数组的最小数字 {

    public int minArray(int[] numbers) {

        int i = 0, j = numbers.length - 1;
        while (i < j) {
            //只要右边比中间大，那右边一定是有序数组
            int m = (i + j) / 2;
            if (numbers[m] > numbers[j])
                i = m + 1;
            else if (numbers[m] < numbers[j])
                j = m;
            // 去重
            else
                j--;
        }
        return numbers[i];
    }
}
